<?php
declare (strict_types = 1);

namespace app\model;

use think\Model;

/**
 * @mixin \think\Model
 */
class AdminParentsData extends Model
{
    //
	public function getLastLoginTimeAttr($value) {
        return $value > 0 ? date('Y-m-d H:i:s', $value) : '';
    }
	
	public function getLastBindDeviceTimeAttr($value) {
        return $value > 0 ? date('Y-m-d H:i', $value) : '';
    }

    public function getStatusTextAttr($value,$data)
    {
        $status = [0=>'未绑定',1=>'已绑定',2 => '申请解绑', 3=> '已解绑'];
        return $status[$data['bind_device_status']];
    }

	public function parents() {
        return $this->belongsTo(AdminParents::class, 'parent_id');
    }
}
